using System;

namespace Blader.UI.TextBox
{
    /// <summary>
    /// Summary description for AutoCompleteDictionaryEntry.
    /// </summary>
    [Serializable]
    public class AutoCompleteEntry : IAutoCompleteEntry
    {
        private string displayName = string.Empty;
        private string value;
        private string projectName;

        public AutoCompleteEntry()
        {
        }

        public AutoCompleteEntry(string displayName, string value, string projectName)
        {
            this.displayName = displayName;
            this.value = value;
            this.projectName = projectName;
        }

        public string DisplayName
        {
            get { return displayName; }
            set { displayName = value; }
        }

        public string Value
        {
            get { return value; }
            set { this.value = value; }
        }

        public override string ToString()
        {
            return !string.IsNullOrEmpty(projectName) ? string.Format("{0} ::  {1}", displayName, projectName) : displayName;
        }

        public bool IsMatch(string text)
        {
            return value.IndexOf(text, StringComparison.CurrentCultureIgnoreCase) > -1;
        }
    }
}